package org.example.classdemo.parameterizedtype;

import org.example.classdemo.genericsuperclass.UserService;
import org.springframework.core.ResolvableType;

public class SpringResolvable {
    public static void main(String[] args) {
        /**
         * 获取超类类型Type,如果是参数化类型,可以通过getGeneric获取泛型的类型或者class对象
         */
        ResolvableType resolvableType = ResolvableType.forType(UserService.class.getGenericSuperclass());
        System.out.println(resolvableType.getGeneric(0).getType().getTypeName());
        System.out.println(resolvableType.getGeneric(0).resolve().getTypeName());
    }
}
